\documentclass[11pt]{article}
\topmargin -0.25in
\textheight 8.7in
\textwidth 6.5in
\oddsidemargin 0.0in      % Left margin = 1.0in

\usepackage{alltt}
%\input{../../sty/preamble}

\begin{document}
\begin{center}
{\bf
TAO - Toolkit for Advanced Optimization
        
Tutorial and Exercises

\vspace{0.25in}

Workshop on the ACTS Toolkit

August 24--27, 2004

National Energy Research Scientific Computing Center
}
\end{center}
\vspace{0.25in}

\begin{enumerate}

\item Locate the TAO and PETSc documentation at 
\begin{alltt}
http://www.mcs.anl.gov/tao
http://www.mcs.anl.gov/petsc
\end{alltt}

\item On seaborg, set the environmental variables
\texttt{TAO\_DIR}, \texttt{PETSC\_DIR}, \texttt{PETSC\_ARCH} 
using the commands:
\begin{alltt}
% module load tao/1.7
% module load petsc/2.2.1
\end{alltt}

\item Create a subdirectory such as \texttt{taoexamples}, enter it, and copy several example problems using the
command:
\begin{alltt}
% mkdir taoexamples
% cd taoexamples
% cp -R \$TAO_DIR/src/unconstrained/examples/tutorials/* .
% ls
\end{alltt}
There should be a \texttt{makefile} and several examples ending in \texttt{.c} and \texttt{.f}.

\item Run an example with TAO.
We are going to use TAO to minimize the function 
\[
    f(x_1,x_2) = 99*(x_2-{x_1}^2)^2 + (1-x_1)^2 
\]
on a single processor.
\begin{itemize}

 \item Compile the program using \\
  \quad \texttt{ \% make BOPT=O\_c++ rosenbrock1} 
  (or \texttt{ \% make BOPT=O\_c++ rosenbrock1f})

 \item Execute the program with \\
  \quad \texttt{ \% poe ./rosenbrock1 -nprocs 1 -tao\_monitor -tao\_view -retry 30} (or
  \texttt{ \% poe ./rosenbrock1f -nprocs 1 -tao\_monitor -tao\_view -retry 30})

  What method was used to solve the problem?
  What is the function value at the final iterate? 
  How many iterates were used to reach the solution?  
  How many function evaluations?

 \newpage

\end{itemize}

\item
Another TAO example finds the minimum surface area of an object over a
two-dimensional domain in accordance with some boundary conditions.

\begin{itemize}

\item
Compile and execute the \texttt{minsurf2} example using
    
\texttt{\% make BOPT=O\_c++ minsurf2}

\texttt{\% poe ./minsurf2 -procs 1 -tao\_monitor -tao\_view}

\item
This problem uses the variables {\tt mx} and {\tt my} to determine
the discretization of the grid.  By default, these values are set to
$4$ ($4 \times 4 = 16$ variables). Increase the discretization of the 
domain by using the command 

\texttt{\% poe ./minsurf2 -procs 1 -tao\_monitor -tao\_view -mx 20 -my 20}

How does this affect the solution?
Try different solvers using the option \texttt{-tao\_method} followed by
\texttt{tao\_cg\_fr},
\texttt{tao\_lmvm}, \texttt{tao\_ntr}, or \texttt{tao\_nls}.
How many iterations do the following solvers require to solve the problem?


\item
Execute the programs from the last step again, but this time use the command line option 
\texttt{-log\_summary} to get detailed performance information.

Look under the PETSc Performance Summary section and determine how long
each algorithm takes to solve the problem. How many floating point operations (flops) are required? 


\item
Run the problem \texttt{minsurf2.c} on two processors and view the output.

\texttt{\% poe ./minsurf2 -procs 2 -tao\_monitor -mx 20 -my 20 -log\_summary -retry 30 -retrycount 10}

\end{itemize}

\item 
  Locate \texttt{minsurf2.c} in the TAO documentation on its web site.  Browse through
  the online version this example and follow the links for
  \texttt{TaoCreate()} and other routines.  Read the online documentation for these routines.

\begin{itemize}
  \item 
  Run \texttt{minsurf2} again using other unconstrained minimization 
  methods.    You can change the solver by modifying the arguments of 
  \texttt{TaoCreate()} or using the runtime option \texttt{-tao\_method <solver>}.
 
  What is the function value at the final iterate?
  How many iterates were used to reach
  the solution?  What was the final residual value? What does the residual represent?

 \item 
  Change the starting vector \texttt{x} by editing the file \texttt{minsurf2.c}.  
  Use the PETSc method {\tt VecSet()}
  to set the vector components to a constant, or {\tt VecSetValue()} to set 
  an individual elements (remember to follow any {\tt VecSetValue()} calls
  with {\tt VecAssemblyBegin()} and {\tt VecAssemblyEnd()}).  Compile the program again and run it.
  How did the starting point affect the convergence?

 \item Print the solution using the PETSc command {\tt VecView()}.
\end{itemize}

\end{enumerate}
\end{document}


